package qinggui.mlz.app.controller.tag;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import qinggui.mlz.module.tag.entity.Tag;
import qinggui.mlz.module.tag.service.TagService;
import qinggui.mlz.module.utils.Response;

import java.util.List;

/**
 * <p>
 * 标签表 前端控制器
 * </p>
 *
 * @author qinggui
 * @since 2025-08-10
 */
@RestController
@Slf4j
public class TagController {

    @Autowired
    private TagService tagService;

    /**
     * 获取列表标签
     * @return Response
     */
    @RequestMapping("/tag/list")
    public Response getAll() {
        List<Tag> allList = null;
        try {
            allList = tagService.getAllList();
        } catch (Exception e) {
            log.error("获取列表标签失败", e);
            throw new RuntimeException(e);
        }
        if (allList == null) {
            return null;
        }
        return new Response<>(1001, allList);
    }


}
